package com.app17cos;

import java.util.List;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.LinearLayout;
import android.widget.TextView;

public class DetailRoleListBaseAdapter extends BaseAdapter {

	private Context context;
	private List<DetailRoleData> list;
	
	public DetailRoleListBaseAdapter(Context context,List<DetailRoleData> list){
		this.context = context;
		this.list = list;
	}
	
	public Context getContext(){
		return this.context;
	}
	
	@Override
	public int getCount() {
		return list.size();
	}

	@Override
	public DetailRoleData getItem(int arg0) {
		return list.get(arg0);
	}

	@Override
	public long getItemId(int arg0) {
		return arg0;
	}

	@Override
	public View getView(int arg0, View arg1, ViewGroup arg2) {
		LinearLayout ll = null;
		if (arg1 != null) {
			ll = (LinearLayout) arg1;
		} else {
			ll = (LinearLayout) LayoutInflater.from(getContext()).inflate(
					R.layout.detail_role_list, null);
		}
		
		DetailRoleData data = getItem(arg0);
		TextView rolename = (TextView) ll.findViewById(R.id.txt_d_RoleName);
		TextView coser = (TextView) ll.findViewById(R.id.txt_d_coser);
		if (data != null) {
			rolename.setText(data.rolename);
			coser.setText(data.coser);
		}
		
		return ll;
	}

}
